<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="./css/detail.css">
    <link rel="shortcut icon" href="./favicon.png" type="image/x-icon">
    <script async="async" src="https://www.google.com/adsense/search/ads.js"></script>
    <script src="./js/vue@2.js"></script>
    <title>Goodlifestylenow</title>
    <!-- other head elements from your page -->
    <script type="text/javascript" charset="utf-8">
        (function (g, o) {
            g[o] = g[o] || function () {
                (g[o]['q'] = g[o]['q'] || []).push(
                    arguments)
            }, g[o]['t'] = 1 * new Date
        })(window, '_googCsa');
    </script>
</head>

<body>
    <div id="app" v-cloak>
        <a-header></a-header>
        <main>
            <div class="content">
                <div class="bread">
                    <a class="bread-home" href="./index.html">Home</a>
                    <a href="#">{{detail.name}}</a>
                </div>
                <div class="content-wrapper">
                    <div class="content-wrapper-main">
                        <div class="main">
                            <div class="article">
                                <h1 class="article-title">{{detail.title}}</h1>
                                <span class="article-sub">{{detail.information}}</span>
                                <div id="relatedsearches1" style="margin: 5px 0;"></div>
                                <p class="article-content" v-html="detail.blogContent"></p>
                            </div>
                        </div>
                        <section style="padding-top: 50px;">
                            <div class="top-wrapper">
                                <div class="news" v-for="(news, index) in recommend" :key="news.id">
                                    <a :href="useToDetail(news.id)">
                                        <img class="news-poster" :src="news.img" loading="lazy" :alt="news.title"
                                            width="260">
                                        <div class="">
                                            <span class="news-type">{{news.name}}</span>
                                            <h2 class="news-title">{{news.title}}</h2>
                                        </div>
                                    </a>
                                </div>
                            </div>
                        </section>
                    </div>
                    <div class="content-wrapper-side">
                        <div class="content-wrapper-side-news">
                            <h5>TRENDING ARTICLES</h5>
                            <ul class="side-list">
                                <li v-for="(news, index) in side" :key="news.id">
                                    <div class="corner">{{index+1}}</div>
                                    <a class="side-list-item" :href="useToDetail(news.id)">
                                        <img class="side-news-poster" :src="news.img" :alt="news.title">
                                        <p class="side-news-title">{{news.title}}</p>
                                    </a>
                                </li>
                            </ul>
                        </div>
                        <div class="content-wrapper-side-ad">
                            <div class="ad">
                                <div class="ad-wrapper">

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
        <a-footer></a-footer>
    </div>
</body>
<script src="./main.js"></script>
<script type="module">
    import { header, footer } from './components/index.js'
    var vm = new Vue({
        el: '#app',
        components: {
            aHeader: header,
            aFooter: footer
        },
        data() {
            return {
                loading: true,
                detail: {},
                side: [],
                id: 0,
                type: 0,
                recommend: [],
                v_vendor: '',
                v_renderer: ''
            }
        },
        computed: {
            recommend() {
                return this.list.filter(item => item.id != this.id)
            }
        },
        created() {
            this.id = getQueryVariable('id') ? getQueryVariable('id') : 2210

            const typeName = getQueryVariable('typeName') ? decodeURIComponent(getQueryVariable('typeName')) : 'Finance'

            this.handleFetchArticleDetail()
            this.handleFetchArticle()
        },
        methods: {
            getWebGLContext() {
                const canvas = document.createElement('canvas');
                canvas.id = 'webglCanvas';
                canvas.width = 1;
                canvas.height = 1;
                canvas.style.display = 'none'; // 隐藏 canvas
                document.body.appendChild(canvas);

                const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
                if (!gl) {
                    console.error('Unable to initialize WebGL. Your browser may not support it.');
                    return;
                }
                const debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
                if (debugInfo) {
                    this.v_vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
                    this.v_renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);

                    // console.log('WebGL Vendor:', v_vendor);
                    // console.log('WebGL Renderer:', v_renderer);
                } else {
                    console.log('WEBGL_debug_renderer_info is not supported by your browser');
                }
            },
            getScreenAndWindowProperties() {
                const properties = {
                    availHeight: window.screen.availHeight,
                    availWidth: window.screen.availWidth,
                    colorDepth: window.screen.colorDepth,
                    height: window.screen.height,
                    innerHeight: window.innerHeight,
                    innerWidth: window.innerWidth,
                    width: window.screen.width,
                    devicePixelRatio: window.devicePixelRatio,
                    maxTouchPoints: navigator.maxTouchPoints
                };
                return properties;
            },
            handleGetAu() {
                if (localStorage.getItem('__hasUpload__')) {
                    return
                }
                this.getWebGLContext()
                const au = navigator.userAgent
                var v_platform = navigator.platform + "," + (navigator.hardwareConcurrency || 'NotAvailable') + "," + (navigator.deviceMemory ? navigator.deviceMemory + 'GB' : 'NotAvailable') + "," + navigator.language;
                var v_screens = this.getScreenAndWindowProperties();
                var renderer = v_vendor + "|" + v_renderer;
                console.log(renderer)
                fetch('https://www.migame.vip/gamefront/ua/addAu', {
                    headers: {
                        'Content-Type': 'application/json; charset=utf-8'
                    },
                    method: 'post',
                    body: JSON.stringify({
                        channelId: 8054,
                        channelUa: au,
                        platform: v_platform,
                        screens: JSON.stringify(v_screens),
                        renderer: renderer,
                        referrer: document.referrer
                    })
                })
                    .then(res => res.text())
                    .then(response => {
                        localStorage.setItem('__hasUpload__', true)
                    })
                    .catch(function (error) {
                        // 请求失败后执行的回调函数
                        console.log('error:', error)
                    })
            },
            loadAfs() {
                const url = new URL(location.href);
                const params = new URLSearchParams(url.search)
                const terms = 'Online Bank Account Opening,Bank Account Opening,Bank Account Opening Customer Journey,Digital Account Opening Solutions'
                var pageOptions = {
                    "hl": "en", // 地区代码默认 en
                    "pubId": "partner-pub-8180331903483073", // 确保这是正确的客户 ID！
                    "styleId": "5656699401",
                    "terms": this.detail.keyword ? this.detail.keyword : terms,
                    // "channel": "7359065559",
                    "relatedSearchTargeting": "content",
                    "resultsPageBaseUrl": "https://www.goodlifestylenow.com/search.html" + url.search, // 输入您的结果页的基准网址
                    "ivt": false,
                    "ignoredPageParams": [...params.keys()].join(','),
                    "resultsPageQueryParam": "keywords", // （默认设为“q”）匹配搜索页上表示查询的参数
                    // "query": this.fetch ? this.detail.title : this.detail.keywords,
                    "referrerAdCreative": getQueryVariable('referrerAdCreative') ? getQueryVariable('referrerAdCreative') : this.detail.title,
                    "adLoadedCallback": function (containerName, adsLoaded,
                        isExperimentVariant, callbackOptions) {
                        if (adsLoaded) {
                            try {
                                // 很可能不执行任何操作
                                
                            } catch (e) {
                                console.error(e)
                                alert("回调函数中存在错误");
                                // 执行某些操作，以妥善处理错误
                            }
                        } else {
                            // _googCsa('relatedsearch', pageOptions, rsblock1);
                            // 采用 Google 无法提供任何广告时的一贯做法

                        }
                    }
                };

                var rsblock1 = {
                    "container": "relatedsearches1",
                    "relatedSearches": 7
                };

                _googCsa('relatedsearch', pageOptions, rsblock1);
            },
            handleFetchArticleDetail() {
                fetch('https://migame.vip/gamefront/blog/findBlogApiOne', {
                    headers: {
                        'Content-Type': 'application/json; charset=utf-8'
                    },
                    method: 'post',
                    body: JSON.stringify({
                        id: this.id
                    })
                })
                    .then(res => res.json())
                    .then(res => {
                        if (res.code == 0) {
                            this.loading = false
                            this.detail = res.data
                            document.title = res.data.title
                            document.head.querySelector('meta[name="description"]').setAttribute('content', res.data.information)
                        }
                        this.$nextTick(this.loadAfs)
                    })
                    .catch(err => {
                        throw new Error(err)
                    })
            },
            handleFetchArticle() {
                fetch('https://migame.vip/gamefront/blog/blogApiList', {
                    headers: {
                        'Content-Type': 'application/json; charset=utf-8'
                    },
                    method: 'post',
                    body: JSON.stringify({
                        pageNum: 1,
                        pageSize: 12,
                        blogTypeId: this.type ? this.type.id : 1,
                        siteId,
                    })
                })
                    .then(res => res.json())
                    .then(res => {
                        if (res.code == 0) {
                            this.side = res.data.splice(0, 6)
                            this.recommend = res.data
                        }
                    })
                    .catch(err => {
                        throw new Error(err)
                    })
            },
        }
    })
</script>
<script>
    var pattern = /^master/;
    window.addEventListener('blur', function () {
        if (document.activeElement.tagName.toLowerCase() == 'iframe') {
            gtag('event', 'content_click', {
                'event_name': 'content_click'
            })
        }
    })
</script>

</html>